//
//  SISSOrderEvaluateViewCell.m
//  SISSAPP
//
//  Created by 优房网 on 2017/5/2.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSOrderEvaluateViewCell.h"
#import "SISSStarsShowView.h"

@interface SISSOrderEvaluateViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *markLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet SISSStarsShowView *houseValidityView;
@property (weak, nonatomic) IBOutlet SISSStarsShowView *serviceSatisfyView;
@property (weak, nonatomic) IBOutlet SISSStarsShowView *businessProfessionalView;
@property (weak, nonatomic) IBOutlet UILabel *commentLabel;
@property (weak, nonatomic) IBOutlet UIView *addLine;
@property (weak, nonatomic) IBOutlet UILabel *addtionalTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *addtionalContentLabel;

@end
@implementation SISSOrderEvaluateViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.markLabel.layer.borderWidth = 1;
    self.markLabel.layer.borderColor = COLOR(0x249DC5).CGColor;
    self.markLabel.layer.cornerRadius = 2;
    self.markLabel.layer.masksToBounds = YES;
   
}

- (void)setCommentModel:(SISSCommentModel *)commentModel {
    _commentModel = commentModel;
    
    NSString *fisrtName = commentModel.name.length > 0 ? [commentModel.name substringToIndex:1] : @"";
    self.nameLabel.text = [NSString stringWithFormat:@"%@**",fisrtName];
    self.markLabel.text = commentModel.appraisers;
    self.timeLabel.text = [commentModel.insertTime substringToIndex:10];
    self.houseValidityView.stars = commentModel.house_true_score;
    self.serviceSatisfyView.stars = commentModel.satisfaction_score;
    self.businessProfessionalView.stars = commentModel.profession_score;
    self.commentLabel.text = commentModel.content;
    
    if (commentModel.lstOfAdditional.count) {
        [self hideAddtionalCommentOrNoWithIsHidden:NO];
        self.addtionalTitleLabel.text = [NSString stringWithFormat:@"%@追加",[commentModel.lstOfAdditional.firstObject.insertTime substringToIndex:10]];
        self.addtionalContentLabel.text = commentModel.lstOfAdditional.firstObject.content;
    } else {
        [self hideAddtionalCommentOrNoWithIsHidden:YES];
        self.addtionalTitleLabel.text = @"";
        self.addtionalContentLabel.text =@"";
    }
}

- (void)hideAddtionalCommentOrNoWithIsHidden:(BOOL)isHidden {
    
    self.addLine.hidden = isHidden;
    self.addtionalTitleLabel.hidden = isHidden;
    self.addtionalContentLabel.hidden = isHidden;
}

@end
